1c1fe63a93e7de8fc9c255bc6d6bc011efc9fdca,src/org/jgroups/conf/ClassConfigurator.java,ClassConfigurator,init,#,53
Before Change
}
ClassMap[] mapping=reader.readMagicNumberMapping();
if(mapping != null) {
Short m;
for(int i=0; i < mapping.length; i++) {
m=new Short(mapping[i].getMagicNumber());
try {
Class clazz=mapping[i].getClassForMap();
if(magicMap.containsKey(m)) {
throw new ChannelException("magic key " + m + " (" + clazz.getName() + ')' +
" is already in map; please make sure that " +
"all magic keys are unique");
}
else {
magicMap.put(m, clazz);
classMap.put(clazz, m);
}
}
After Change
// make sure we have a class for DocumentBuilderFactory
Util.loadClass("javax.xml.parsers.DocumentBuilderFactory", ClassConfigurator.class);
String mnfile=null;
try { // PropertyPermission not granted if running in an untrusted environment with JNLP
mnfile=Util.getProperty(new String[]{Global.MAGIC_NUMBER_FILE, "org.jgroups.conf.magicNumberFile"},
null, null, false, MAGIC_NUMBER_FILE);
if(log.isDebugEnabled()) log.debug("Using " + mnfile + " as magic number file");
}
catch (SecurityException ex){
}
List<Tuple<Short,String>> mapping=readMagicNumberMapping(mnfile);
for(Tuple<Short,String> tuple: mapping) {
short m=tuple.getVal1();
try {
Class clazz=Util.loadClass(tuple.getVal2(), ClassConfigurator.class);
if(magicMap.containsKey(m))
throw new ChannelException("key " + m + " (" + clazz.getName() + ')' +
" is already in map; please make sure that all keys are unique");
magicMap.put(m, clazz);
classMap.put(clazz, m);
}
catch(ClassNotFoundException cnf) {